﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/static/include/topLess.jsp"%>
<form name="searchForm" action="${baseURL}/user/modify" method="post">
<input type="hidden" name="userId" value="${user.id}" />
<table id="listTable">
	<tbody>
		<tr>
			<td class="tab_td_all" width="50%">登录名： <input
				id="userLoginname" type="text" name="userLoginname"
				value="${user.userLoginname}" size="20" class="tab_textbut" />
			</td>
			<td class="tab_td_rig">权限角色： 
				<select id="authorId" name="authorId" class="tab_textbut">
					<option value="">请选择..</option>
					<c:forEach var="author" items="${authorList}">
						<option value="${author.id}"
							${author.id==user.authorId?'selected':''}>${author.authorName}</option>
					</c:forEach>
			</select>
			</td>
		</tr>
		<tr>
		
			<td class="tab_td_all" colspan="2"><input type="hidden" id="unitId" name="unitId" value="${unit.id}" />单位详细名称：<input id="unitName"
				name="unitName" type="text" readonly="readonly" class="tab_textbut_200"	value="${unit.unitName}" /> 
				<a href="#" onclick="chooseUnit()"><img border="0"	src="${ctx}/static/images/icons/ss1.gif" /></a></td>

		</tr>
		<tr>
			<td class="tab_td_all">机构代码：<input id="userInstitutionCode" class="tab_textbut"
				name="userInstitutionCode" type="text" readonly="readonly"
				value="${unit.unitInstitutionCode}" /></td>
			<td class="tab_td_rig">联系人：<input id="userContactPerson" class="tab_textbut"
				name="userContactPerson" type="text" readonly="readonly"
				value="${unit.fr}" /></td>
		</tr>
		<tr>
			<td class="tab_td_all">地区名称：<input id="userAreaName" class="tab_textbut"
				name="userAreaName" type="text" readonly="readonly"
				value="${unit.areaName}" /></td>
			<td class="tab_td_rig">角&nbsp;&nbsp;&nbsp;色：<input id="roleName" name="roleName" class="tab_textbut"
				type="text" readonly="readonly" value="${unit.roleName}" /></td>
		</tr>
		<tr>
			<td class="tab_td_all" colspan="2">企业注册地址：<input id="registAdd" class="tab_textbut"
				name="registAdd" type="text" readonly="readonly"
				value="${unit.registAdd}" /></td>

		</tr>

		<tr>
			<td class="tab_td_all">使用状态：
			 <select id="enterpriseUserUseSystem" name="enterpriseUserUseSystem" class="tab_textbut">
					<option value="1"
						<c:if	test="${user.enterpriseUserUseSystem==1}">selected</c:if>>正常</option>
					<option value="0"
						<c:if test="${user.enterpriseUserUseSystem==0}">selected</c:if>>注销</option>
			</select>
			</td>
			<td class="tab_td_rig">&nbsp;</td>
		</tr>
		<tr>
			<td class="tab_td_all" colspan="2">报表分组：添加行业报表分组
			 <a href="#" onclick="chooseIndustry()"><img border="0" src="${ctx}/static/images/icons/ss1.gif" /></a></td>
		</tr>
		<tr>
			<td class="tab_td_all" colspan="2">
				<div style="height: 200px; overflow-y: scroll;">
					<table id="listTable1" border="1">
						<tbody>
							<tr>
								<th>行业名称</th>
								<th width="10%">功能</th>
							</tr>
							<c:forEach var="oneRow" items="${industryList}">
								<c:if test="${oneRow.check==true}">
									<tr>
										<td align="left"><input type="hidden" name="dustryId" value="${oneRow.id}" />${oneRow.dustryName}</td>
										<td><div class="delIcon" onclick='deleteTr(this);' style='cursor:pointer'></div></td>
									</tr>
								</c:if>
							</c:forEach>
						</tbody>
					</table>
				</div>
			</td>
		</tr>
		<tr>
			<td class="tab_td_all" align="center" colspan="2">
			<input name="submit" type="submit" value="提交" class="tab_but"  /><input
				class="tab_but" type="button" value="关闭" onclick="closeWin();" /></td>
		</tr>
	</tbody>
</table>
</form>

<script>
	function selectAll(checkAllFlag) {
		var checkArray = document.getElementsByName("userIndustry");
		for (var i = 0; i < checkArray.length; i++) {
			checkArray[i].checked = checkAllFlag;
		}
	}

	function chooseUnit() {
		openWin("查询单位", "${baseURL}/unit/select", 600, 500, setValue);
	}

	function chooseIndustry() {
		openWin("查询行业", "${baseURL}/user/industrySelect", 600, 500,
				setIndustryValue);
	}

	function setIndustryValue(data) {
		$.each(data, function(index, content) {
		//	alert("<input type=\"hidden\" name=\"dustryId\" value=\""+content.id+"\" />");
			var trHTML = "<tr><td><input type=\"hidden\" name=\"dustryId\" value=\""+content.id+"\" />" + content.name + "</td><td>1</td></tr>";
		//	var trHTML = "<tr><td>" + content.name + "</td><td>1</td></tr>";
			$("#listTable1").append(trHTML);
		});
	}
	
	function deleteTr(nowTr){
        //多一个parent就代表向前一个标签,
        //本删除范围为<td><tr>两个标签,即向前两个parent
        //如果多一个parent就会删除整个table
        $(nowTr).parent().parent().remove();
    }
	function setValue(data) {
		
		document.getElementById("unitId").value = data.id;
		document.getElementById("unitName").value = data.unitName;
		document.getElementById("userInstitutionCode").value = data.unitInstitutionCode;
		document.getElementById("userContactPerson").value = data.fr;
		document.getElementById("userAreaName").value = data.areaName;
		document.getElementById("roleName").value = data.roleName;
		document.getElementById("registAdd").value = data.registAdd;
	}
</script>
<%@ include file="/static/include/bottom.jsp"%>